'use strict';

const Controller = require('egg').Controller;

class SearchController extends Controller {
    async getWords() {
        let {ctx,service} = this;
        let {key} = ctx.query;
        let {uid} = ctx.info;

        if(key){
            let wordLists = await service.search.getWords(key,uid);
            ctx.body = {
                code:1,
                data:wordLists
            }
        }else{
            ctx.body = {
                code:2,
                msg:'参数有误'
            }
        }
    }
}

module.exports = SearchController;
